package com.scs.application.modules.wm.entity;

import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.scs.application.core.entity.SimpleDataEntity;
import com.scs.application.modules.base.dto.ExpandColumnDTO;
import com.scs.application.modules.upgrade.db.annotation.EntityClassAnnotation;
import com.scs.application.modules.upgrade.db.annotation.EntityFieldAnnotation;
import com.scs.application.modules.upgrade.db.annotation.EntityIndexAnnotation;
import com.scs.application.modules.upgrade.db.enums.EntityFieldType;
import lombok.Data;
import lombok.experimental.Accessors;

import java.util.Date;
import java.util.List;

/**
 * <p>
 * 入库单明细
 * </p>
 */
@Data
@Accessors(chain = true)
@TableName("wm_work_order_item")
@EntityIndexAnnotation(ix = {"work_order_id","line_id","stock_id","location_id","matr_id","sn","rfid","po_item_id"})
@EntityClassAnnotation(remark = "出入库明细表")
public class WorkOrderItem extends SimpleDataEntity {


    // id ,在父类中处理

    @EntityFieldAnnotation(
            text = "原始入库单明细ID",
            type = EntityFieldType.LONG,
            length = "",
            not_null = false,
            default_value = "",
            comment = ""
    )
    private String lineId;

    @EntityFieldAnnotation(
            text = "工单单ID",
            type = EntityFieldType.LONG,
            length = "",
            not_null = true,
            default_value = "",
            comment = ""
    )
    private String workOrderId;

    @EntityFieldAnnotation(
            text = "库存ID",
            type = EntityFieldType.LONG,
            length = "",
            not_null = false,
            default_value = "",
            comment = ""
    )
    private String stockId;

    @EntityFieldAnnotation(
            text = "库位ID",
            type = EntityFieldType.LONG,
            length = "",
            not_null = true,
            default_value = "",
            comment = ""
    )
    private String locationId;

    @EntityFieldAnnotation(
            text = "库位名称",
            length = "50",
            not_null = true,
            default_value = "",
            comment = ""
    )
    private String locationName;

    @EntityFieldAnnotation(
            text = "包ID",
            type = EntityFieldType.LONG,
            length = "",
            not_null = false,
            default_value = "",
            comment = ""
    )
    private String packId;

    @EntityFieldAnnotation(
            text = "包入库明细id",
            type = EntityFieldType.LONG,
            length = "",
            not_null = false,
            default_value = "",
            comment = ""
    )
    private String packItemId;

    @EntityFieldAnnotation(
            text = "0：非包装耗材; 1:跟台包",
            length = "30",
            not_null = false,
            default_value = "0",
            comment = ""
    )
    private String matrType;

    @EntityFieldAnnotation(
            text = "物料ID",
            type = EntityFieldType.LONG,
            length = "",
            not_null = true,
            default_value = "",
            comment = ""
    )
    private String matrId;

    @EntityFieldAnnotation(
            text = "物料名称",
            length = "100",
            not_null = true,
            default_value = "",
            comment = ""
    )
    private String matrName;

    @EntityFieldAnnotation(
            text = "物料品规",
            length = "100",
            not_null = true,
            default_value = "",
            comment = ""
    )
    private String matrSpec;

    @EntityFieldAnnotation(
            text = "包装单位",
            length = "10",
            not_null = true,
            default_value = "",
            comment = ""
    )
    private String packageUnit;

    @EntityFieldAnnotation(
            text = "包装数量",
            length = "",
            not_null = true,
            default_value = "",
            comment = ""
    )
    private Double packageQty;

    @EntityFieldAnnotation(
            text = "单品价格",
            length = "",
            not_null = true,
            default_value = "",
            comment = ""
    )
    private Double skuPrice;


    @EntityFieldAnnotation(
            text = "采购单品价格",
            length = "",
            not_null = false,
            default_value = "0",
            comment = "仅采购入库有空"
    )
    private Double skuPriceSp;

    @EntityFieldAnnotation(
            text = "单品单位",
            length = "10",
            not_null = false,
            default_value = "",
            comment = ""
    )
    private String skuUnit;

    @EntityFieldAnnotation(
            text = "单品数量",
            length = "",
            not_null = true,
            default_value = "",
            comment = ""
    )
    private Double skuQty;

    @EntityFieldAnnotation(
            text = "金额",
            length = "",
            not_null = true,
            default_value = "",
            comment = ""
    )
    private Double amount;

    @EntityFieldAnnotation(
            text = "批次",
            length = "50",
            not_null = true,
            default_value = "",
            comment = ""
    )
    private String lot;

    @JsonFormat(pattern="yyyy/MM/dd", timezone = "GMT+8")
    @EntityFieldAnnotation(
            text = "效期",
            length = "",
            not_null = true,
            default_value = "",
            comment = ""
    )
    private Date expDate;

    @JsonFormat(pattern="yyyy/MM/dd", timezone = "GMT+8")
    @TableField(strategy = FieldStrategy.IGNORED)
    @EntityFieldAnnotation(
            text = "生产日期",
            length = "",
            not_null = false,
            default_value = "",
            comment = ""
    )
    private Date mfgDate;

    @JsonFormat(pattern="yyyy/MM/dd", timezone = "GMT+8")
    @EntityFieldAnnotation(
            text = "灭菌日期",
            length = "",
            not_null = false,
            default_value = "",
            comment = ""
    )
    private Date sterilizationDate;

    @JsonFormat(pattern="yyyy/MM/dd", timezone = "GMT+8")
    @EntityFieldAnnotation(
            text = "灭菌有效期",
            length = "",
            not_null = false,
            default_value = "",
            comment = ""
    )
    private Date sterilizationIndate;

    @EntityFieldAnnotation(
            text = "注册证号",
            length = "100",
            not_null = false,
            default_value = "",
            comment = ""
    )
    private String certificateNo;

    @EntityFieldAnnotation(
            text = "发票号",
            length = "30",
            not_null = false,
            default_value = "",
            comment = ""
    )
    private String invoiceNo;

    @EntityFieldAnnotation(
            text = "",
            length = "30",
            not_null = false,
            default_value = "",
            comment = ""
    )
    private String sn;

    @EntityFieldAnnotation(
            text = "",
            length = "30",
            not_null = false,
            default_value = "",
            comment = "厂商序列号"
    )
    private String mfgSn;

    @EntityFieldAnnotation(
            text = "",
            length = "30",
            not_null = false,
            default_value = "",
            comment = ""
    )
    private String rfid;

    @EntityFieldAnnotation(
            text = "",
            length = "100",
            not_null = false,
            default_value = "",
            comment = ""
    )
    private String udi;

    @EntityFieldAnnotation(
            text = "厂商",
            length = "200",
            not_null = false,
            default_value = "",
            comment = ""
    )
    private String mfgName;

    @EntityFieldAnnotation(
            text = "备注",
            length = "100",
            not_null = false,
            default_value = "",
            comment = ""
    )
    private String remark;
    @EntityFieldAnnotation(
            text = "采购明细Id",
            type = EntityFieldType.LONG,
            length = "",
            not_null = false,
            default_value = "",
            comment = ""
    )
    private String poItemId;

    @EntityFieldAnnotation(
            text = "是临时采购",
            length = "100",
            not_null = false,
            default_value = "0",
            comment = "1:是,0:否"
    )
    private Boolean flagTemporaryPurchase;

    @EntityFieldAnnotation(
            text = "原始业务明细数据id",
            length = "",
            not_null = false,
            default_value = "",
            comment = ""
    )
    private String refBusItemId;

    @EntityFieldAnnotation(
            text = "耗材型号",
            length = "100",
            not_null = false,
            default_value = "",
            comment = "耗材型号"
    )
    private String matrModel;

    @EntityFieldAnnotation(
            text = "finance_bill.id",
            type = EntityFieldType.LONG,
            length = "",
            not_null = false,
            default_value = "",
            comment = ""
    )
    private String billId;
    @EntityFieldAnnotation(
            text = "finance_bill_item.id",
            type = EntityFieldType.LONG,
            length = "",
            not_null = false,
            default_value = "",
            comment = ""
    )
    private String billItemId;

    @EntityFieldAnnotation(
            text = "医保代码",
            length = "32",
            not_null = false,
            default_value = "",
            comment = "医保代码"
    )
    private String hisMedicareNo;

    @TableField(exist = false)
    private String bidno;

    @TableField(exist = false)
    private String hrpCode;

    @TableField(exist = false)
    private String baseType;

    @TableField(exist = false)
    private Boolean flagCenterPurchase;

    @TableField(exist = false)
    private Boolean flagGys;

    @EntityFieldAnnotation(
            text = "包装转换率",
            length = "",
            not_null = false,
            default_value = "",
            comment = "比率"
    )
    private Double packageRate;


    @EntityFieldAnnotation(
            text = "商品采购类型",
            not_null = false,
            default_value = "",
            comment = "商品采购类型，来自数据字典 purchase_type"
    )
    private String matrPurchaseType;


    // 子数据
    @TableField(exist = false)
    private List<WorkOrderItem> childData;

    // 字段列表
    @TableField(exist = false)
    private List<ExpandColumnDTO> childCols;

    // 是否显示展开行
    @TableField(exist = false)
    private Boolean showExpand;

}
